home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turnbull China Bikeride
/
Turnbull China Bikeride - Disc 2.iso
/
STUTTGART
/
UTIL
/
SYS
/
IFFILE
/
_files
/
iffile_doc
< prev
next >
Wrap
Text File
|
1991-04-24
|
785b
|
30 lines
Here is yet another useful utility, infact about six utilities but the source
to them is very similar. This code is for IfFile, which executes the command
tail if the first parameter if a file that exists. You can change this to test
for directories or the absence of the named object.
(As before, assemble and save as a utility (&FFC)).
MOV R8,R1
.loop
LDRB R0,[R8],#1
CMP R0,#32
BHI loop
MOV R0,#0
STRB R0,[R8,#-1]
MOV R0,#5
SWI "XOS_File"
MOVVS PC,R14
.fix
CMP R0,#1 ; 0 for IfNoFile, 2 for IfDir
MOV R0,R8
SWIEQ "XOS_CLI" ; NE for not
MOV PC,R14
Share and enjoy...
Nicko
+-----------------------------------------------------------------------------+
| Nicko van Someren, nbvs@cl.cam.ac.uk, (44) 223 358707 or (44) 860 498903 |